<!--pay.wxml-->
<import src="../detail/detail" />
<template is="{{template}}" data="{{my_toast_tip: my_toast_tip}}" />
<view class="payPage">
    <view class="payMethod">
        <view class="item" bindtap="select_pay" data-type='4'>
            <view class="left">
                <image src="{{imageUrl}}/pay_balance.png"></image>
                <text class="pay">
                    <text>余额支付:</text>
                    <text class="red">{{util.formatNum(balance)}}元</text>
                </text>
            </view>
            <image wx:if="{{payType==4}}" class="right" src="{{imageUrl}}/pay_select.png"></image>
            <image wx:else class="right" src="{{imageUrl}}/pay_unselect.png"></image>
        </view>
        <view class="item" bindtap="select_pay" data-type='1'>
            <view class="left">
                <image src="{{imageUrl}}/icon_wechat.png"></image>
                <text class="pay">微信支付</text>
            </view>
            <image wx:if="{{payType==1}}" class="right" src="{{imageUrl}}/pay_select.png"></image>
            <image wx:else class="right" src="{{imageUrl}}/pay_unselect.png"></image>
        </view>
        <!-- <view class="item" bindtap="select_pay" data-type='10' wx:if="{{shopType==10}}"> -->
        <view class="item" bindtap="select_pay" data-type='10' wx:if="{{shopType==10}}">
            <view class="left">
                <image src="../../img/pay_rongsheng.png"></image>
                <text class="pay">荣盛币支付:<text class="red">{{rongsheng>0?rongsheng:""}}</text></text>

            </view>
            <image wx:if="{{payType==10}}" class="right" src="{{imageUrl}}/pay_select.png"></image>
            <image wx:else class="right" src="{{imageUrl}}/pay_unselect.png"></image>
        </view>
    </view>
    <view class="productContainer">
        <view class="item" wx:for="{{obj.cartItems}}" wx:key="{{index}}">
            <image wx:if="{{item.goods.imgUrl}}" src="{{item.goods.imgUrl}}"></image>
            <image wx:else src="{{imageUrl}}/xiaomai.jpg"></image>
            <view class="info">
                <view class="title">
                    <image wx:if="{{item.promotionType==9}}" src="{{imageUrl}}/group_image.png"></image>
                    {{item.promotionType==9?item.promotionAlias:item.goods.goodsName}}
                    <!-- {{item.promotionName}}{{item.goods.goodsName}} -->
                </view>
                <view class="pre_price">￥ {{util.formatNum(item.goods.originalPrice)}}
                    <text wx:if="{{item.promotionType==7}}">{{item.promotionAlias}}</text>
                </view>
            </view>
            <view class="num">x {{item.num}}</view>
        </view>
        <!-- <view class="product_footer">
            <view class="left">原价: {{util.formatNum(obj.originalPrice) }}元</view>
            <view class="right">现价:{{util.formatNum(obj.promotionPrice)}}元</view>
        </view> -->
    </view>
    <view id='preferential'>
        <view class='p_items' bindtap="goSelect">
            <label class="p_name"><span>券</span>优惠券</label>
            <label class="p_money">
                <label class="noMaiXiang" wx:if='{{autoFlag==1}}'>无优惠券可用</label>
                <label
                    wx:if='{{autoFlag==3||autoFlag==2}}'>{{showCouponPrice==0||!showCouponPrice?'请选择优惠券':"-¥"+showCouponPrice}}</label>
                <image class="icon" src='{{imageUrl}}/icon_next.png'></image>
            </label>
        </view>
        <view class='p_items'>
            <label class="p_name"><span>促</span>促销活动</label>
            <label class="p_money">
                <label>-¥{{vipsavingPrice}}</label>
                <image class="icon" src='{{imageUrl}}/icon_next.png' style='opacity: 0;'></image>
            </label>
        </view>
        <view class='p_items' wx:if="{{supportMx!=3}}">
            <label class="p_name"><span>享</span>麦享会员</label>
            <label class="p_money">
                <label class="noM_style" bindtap='maixiangTurn' wx:if='{{supportMx==2&mxCheaper}}'>开通会员
                    最多减{{mxSavingAmount}}元</label>
                <label class="noM_style" bindtap='maixiangTurn' wx:if='{{supportMx==2&!mxCheaper}}'>开通会员
                    再打{{mxDisountRate*10}}折</label>
                <label wx:if='{{supportMx==1}}'>-￥{{mxSavingAmount?mxSavingAmount:0}}</label>
                <image wx:if='{{supportMx==1}}' class="icon" src='{{imageUrl}}/icon_next.png' style='opacity: 0;'>
                </image>
                <image wx:if='{{supportMx!=1}}' class="icon" src='{{imageUrl}}/icon_next.png' style='opacity: 1;'>
                </image>
            </label>
        </view>
        <!--  <view class='p_items'>
            <label class="p_name"><span>送</span>配送费</label>
            <label class="p_money">
                <p><span>¥1.50</span>¥0.00</p>
                <image class="icon" src='{{imageUrl}}/icon_next.png' style='opacity: 0;'></image>
            </label>
        </view> -->
    </view>
    <view class="payInfo">
        <view class="pay_tips">
            <text>{{vipLevel}}:</text>
            <text class="pay_price">{{util.formatNum (obj.promotionPrice)}}</text>
            <text>{{util.formatNum(obj.originalPrice)}}</text>
        </view>
        <form class="pay_sure" bindsubmit="formSubmit" report-submit="true">
            <button class="pay_sure" formType="submit">
                <!-- <label bindtap='payAction'>立即支付</label> -->
                确认
            </button>
        </form>
        <!-- <text class="pay_sure" bindtap="doValite">确认</text> -->
    </view>
</view>
<!-- 获取用户信息 -->
<button wx:if='{{isNeedwx}}' class="nickname-btn" open-type="getUserInfo" bindgetuserinfo="bindGetUserInfo">
    <image wx:if='{{isNeedwx}}' src="../../image/nicheng.png"></image>完善昵称
</button>
<text wx:if='{{isNeedwx}}' class="nickname-hit">获取微信昵称，有助于为您配送</text>
<!--密码-->
<view id='passWord_view' wx:if="{{isShow}}">
    <view id='pw'>
        <image class='clo_style' bindtap="closeView" src="../../image/icon_clo.png"></image>
        <input type="number" bindblur='hideView' placeholder="这是一个可以自动聚焦的input" focus='{{input_type}}'
            bindinput="getPassWord" />
        <label class="msg">请输入余额支付密码</label>
        <label class="point">
            <li wx:for="{{styleList}}" wx:key='{{index}}'><span class="{{item}}"></span></li>
        </label>
    </view>
</view>
<wxs module="util">
    var formatNum=function(n){
    return Number(n)
    }
    module.exports = {
    formatNum : formatNum,
    }
</wxs>